import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
import plugins

from configs.config import load_train_config
from trainer.trainer import Trainer


if __name__ == "__main__":
    cfg = load_train_config("./configs/deeplabv3plus.py")
    trainer = Trainer(cfg)
    trainer.add_plugins([
        plugins.PluginModelTestRun,
        plugins.PluginInitInfo,
        # plugins.AutoResumePlugin,
        plugins.PluginLogger,
        plugins.PluginSaveConfig,
        plugins.PluginScheduler('epoch'),
        plugins.PluginTikTok,
        plugins.TrainingMetricsPlugin,
        plugins.ValEvaluationPlugin,
        plugins.BestModelSaverPlugin,
    ])
    trainer.train()
